package customer.zspt.cn.customer.utils;

import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

/**
 * Created by Administrator on 2018/7/16 0016.
 */

public class Enjoy {
    public  String[] mEnjoyList;
    public  ArrayList<Bitmap> mBitmaps;
    public  Context mContext;
    public Enjoy(Context context){
        mContext = context;
        realdyData();
    }
    public void realdyData(){
        mEnjoyList = new String[]{
                "[微笑]", "[撇嘴]", "[色]", "[发呆]", "[得意]", "[流泪]", "[害羞]",
                "[闭嘴]", "[睡]", "[大哭]", "[尴尬]", "[发怒]", "[调皮]", "[呲牙]",
                "[惊讶]", "[难过]", "[酷]", "[冷汗]", "[抓狂]", "[吐]", "[偷笑]",
                "[可爱]", "[白眼]", "[傲慢]", "[饥饿]", "[困]", "[惊恐]", "[流汗]",
                "[憨笑]", "[大兵]", "[奋斗]", "[咒骂]", "[疑问]", "[嘘]", "[晕]",
                "[折磨]", "[衰]", "[骷髅]", "[敲打]", "[再见]", "[擦汗]", "[抠鼻]",
                "[鼓掌]", "[糗大了]", "[坏笑]", "[左哼哼]", "[右哼哼]", "[哈欠]", "[鄙视]",
                "[委屈]", "[快哭了]", "[阴险]", "[亲亲]", "[吓]", "[可怜]", "[眨眼睛]",
                "[笑哭]", "[doge]", "[泪奔]", "[无奈]", "[托腮]", "[卖萌]", "[斜眼笑]",
                "[喷血]", "[惊喜]", "[骚扰]", "[小纠结]", "[我最美]", "[菜刀]", "[西瓜]",
                "[啤酒]", "[篮球]", "[乒乓]", "[茶]", "[咖啡]", "[饭]", "[猪头]",
                "[玫瑰]", "[凋谢]", "[示爱]", "[爱心]", "[心碎]", "[蛋糕]", "[闪电]",
                "[炸弹]", "[刀]", "[足球]", "[瓢虫]", "[便便]", "[月亮]", "[太阳]",
                "[礼物]", "[拥抱]", "[强]", "[弱]", "[握手]", "[胜利]", "[抱拳]",
                "[勾引]", "[拳头]", "[差劲]", "[爱你]", "[NO]", "[OK]"
        };
        mBitmaps = new ArrayList<>();
        for(int i=0;i<104;i++)
        {
            Bitmap imageFromAssetsFile = getImageFromAssetsFile(mContext, "face/" + i + ".png");
            int width = imageFromAssetsFile.getWidth();
            int height = imageFromAssetsFile.getHeight();
            Matrix matrix = new Matrix();
            matrix.postScale(3, 3);
            Bitmap mbitmap = Bitmap.createBitmap(imageFromAssetsFile, 0, 0, width, height, matrix, true);
            mBitmaps.add(mbitmap);
        }
    }

    public static Bitmap getImageFromAssetsFile(Context context, String fileName) {
        Bitmap image = null;
        AssetManager am = context.getResources().getAssets();
        try {
            InputStream is = am.open(fileName);
            image = BitmapFactory.decodeStream(is);
            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return image;
    }

}
